Skip to content

add RFC 8417 golden conformance fixtures and round-trip tests#10

Merged
hstern merged 1 commit into
mainfrom
secevent-13-conformance-fixtures
Jun 21, 2026
Merged

add RFC 8417 golden conformance fixtures and round-trip tests#10
hstern merged 1 commit into
mainfrom
secevent-13-conformance-fixtures

Conversation

@hstern

@hstern hstern commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Summary

Adds the RFC 8417 golden conformance suite: spec-derived claims-set fixtures under testdata/ and a table-driven round-trip test (conformance_test.go) that drives each one through the full consumer/producer cycle.

RFC 8417 ships prose example figures rather than machine-readable vectors and defines no external conformance suite, so the library's conformance story is internal golden fixtures.

Fixtures

File Source Exercises
scim_create.json RFC 8417 §2.1, transcribed verbatim from the SCIM provisioning example iss, iat, jti, two-member aud array, one SCIM create event
minimal.json Synthetic — smallest SET satisfying the §2.2 MUSTs one event with the empty-object {} payload
txn_toe_subid.json Synthetic txn, toe distinct from iat, an RFC 9493 iss_sub sub_id, aud array
single_aud.json Synthetic bare-string aud, one event decoded to a typed value via the registry

Synthetic fixtures use RFC 2606 example domains and illustrative (non-IANA) event-type URIs; provenance is documented in testdata/README.md. No non-spec vocabulary is presented as if it came from the RFC.

What the test asserts

For each fixture: Parse → assert decoded SET fields (iss/iat/jti/aud/sub_id/txn/toe/events) → Validate returns nil → typed decode through the registry (one registered URI to a typed value, the rest left raw) → Encode. It then pins byte-stability two ways:

  • every event payload appears in the Encode output in its canonical compact form with member order preserved — the property json.RawMessage buys over map[string]any;
  • Parse → Encode → Parse is a fixed point.

The registry decoder is registered once in init so it survives -shuffle/-count without a duplicate-registration panic.

Scope

No library code changes — fixtures and tests only. Runs under the existing test CI job; no workflow changes.

Local checks

gofmt -l clean, go vet ./..., go mod tidy -diff clean, go test -race -shuffle=on ./... green, golangci-lint 0 issues.

🤖 Generated with Claude Code

RFC 8417 ships prose example figures rather than machine-readable test
vectors and defines no external conformance suite, so the library's
conformance story is internal golden fixtures driven through the full
consumer/producer cycle. This lands that suite: four claims-set fixtures
under testdata/ and a table-driven test that exercises each one.

The canonical fixture, scim_create.json, is transcribed verbatim from
the RFC 8417 §2.1 SCIM provisioning example: iss, iat, jti, a two-member
aud array, and a single SCIM create event. The remaining three are
labelled synthetic in testdata/README.md and use RFC 2606 example
domains: minimal.json is the smallest SET satisfying the §2.2 MUSTs (one
event with the empty-object payload); txn_toe_subid.json exercises txn,
a toe distinct from iat, an RFC 9493 iss_sub sub_id, and an aud array;
single_aud.json carries a bare-string aud and an event a registered
decoder turns into a typed value. No non-spec event vocabulary is
presented as if it came from the RFC.

For each fixture the test parses the bytes, asserts the decoded SET
fields, confirms Validate accepts it, decodes events through the
registry (one registered URI to a typed value, the rest left raw), and
Encodes it back. It then pins byte-stability two ways: every event
payload appears in the Encode output in its canonical compact form with
member order preserved — the property json.RawMessage buys over
map[string]any — and Parse → Encode → Parse is a fixed point. The
registry decoder is wired once in init rather than a test body so it
survives -shuffle and -count without a duplicate-registration panic.

No library code changes; fixtures and tests only. These run under the
existing test CI job.

Co-Authored-By: Claude <noreply@anthropic.com>
@hstern hstern enabled auto-merge (squash) June 21, 2026 02:04
@hstern hstern merged commit 4e378df into main Jun 21, 2026
4 checks passed
@hstern hstern deleted the secevent-13-conformance-fixtures branch June 21, 2026 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant